package com.mx.ai.sports.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mx.ai.sports.system.entity.Auth;
import com.mx.ai.sports.system.mapper.AuthMapper;
import com.mx.ai.sports.system.service.IAuthService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 第三方登录Service
 *
 * @author Mengjiaxin
 * @date 2019-08-20 19:58
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class AuthServiceImpl extends ServiceImpl<AuthMapper, Auth> implements IAuthService {


    @Override
    public Auth findAuth(String platform, String openid) {
        return this.baseMapper.selectOne(new LambdaQueryWrapper<Auth>().eq(Auth::getPlatform, platform).eq(Auth::getOpenid, openid));
    }
}
